package com.guojizhuang.writable;

import org.apache.hadoop.io.Writable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class UserActionWritable implements Writable {
    private Long use_ID;
    private Long cat_ID;
    private Long sel_ID;
    private Long act_ID;
    private Long ite_ID;
    private String time;

    public UserActionWritable() {
    }

    public UserActionWritable(Long use_ID, Long cat_ID, Long sel_ID, Long act_ID, Long ite_ID, String time) {
        this.use_ID = use_ID;
        this.cat_ID = cat_ID;
        this.sel_ID = sel_ID;
        this.act_ID = act_ID;
        this.ite_ID = ite_ID;
        this.time = time;
    }

    @Override
    public String toString() {
        return "userAction{" +
                "use_ID=" + use_ID +
                ", cat_ID=" + cat_ID +
                ", sel_ID=" + sel_ID +
                ", act_ID=" + act_ID +
                ", ite_ID=" + ite_ID +
                ", time='" + time + '\'' +
                '}';
    }

    public Long getUse_ID() {
        return use_ID;
    }

    public void setUse_ID(Long use_ID) {
        this.use_ID = use_ID;
    }

    public Long getCat_ID() {
        return cat_ID;
    }

    public void setCat_ID(Long cat_ID) {
        this.cat_ID = cat_ID;
    }

    public Long getSel_ID() {
        return sel_ID;
    }

    public void setSel_ID(Long sel_ID) {
        this.sel_ID = sel_ID;
    }

    public Long getAct_ID() {
        return act_ID;
    }

    public void setAct_ID(Long act_ID) {
        this.act_ID = act_ID;
    }

    public Long getIte_ID() {
        return ite_ID;
    }

    public void setIte_ID(Long ite_ID) {
        this.ite_ID = ite_ID;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    @Override
    public void write(DataOutput dataOutput) throws IOException {
        dataOutput.writeLong(use_ID);
        dataOutput.writeLong(cat_ID);
        dataOutput.writeLong(sel_ID);
        dataOutput.writeLong(act_ID);
        dataOutput.writeLong(ite_ID);
        dataOutput.writeUTF(time);
    }

    @Override
    public void readFields(DataInput dataInput) throws IOException {
        dataInput.readLong();
        dataInput.readLong();
        dataInput.readLong();
        dataInput.readLong();
        dataInput.readLong();
        dataInput.readUTF();
        this.use_ID = dataInput.readLong();
        this.cat_ID = dataInput.readLong();
        this.sel_ID = dataInput.readLong();
        this.act_ID = dataInput.readLong();
        this.ite_ID = dataInput.readLong();
        this.time = dataInput.readUTF();
    }
}
